added the functionality of receiving rewards for completed testing#21
Open
added the functionality of receiving rewards for completed testing#21
Conversation
BubuntuClu
reviewed
Apr 29, 2025
| @test_passage.accept!(params[:answer_ids]) | ||
|
|
||
| @test_passage.check_successful_completed! | ||
| if @test_passage.completed? |
There was a problem hiding this comment.
у тебя тут проверка завершения и внутри check_successful_completed. получается что ты два раза одно и тоже проверяешь - неоптимально. стоит из метода check_successful_completed убрать тогда проверку завершенности и переместить внутрь if
| scope :hard, -> { where(level: :hard) } | ||
| scope :ready, -> { where(status: 1) } | ||
| scope :by_category, ->(category_title) { joins(:category).where(categories: { title: category_title }) } | ||
| scope :by_category, lambda { |category_title| |
There was a problem hiding this comment.
объясни логику этого метода?
1 - передали пустую строку - вернется пустой массив, зачем обработка return self unless category_title.present??
2 -
sanitized_title = ActiveRecord::Base.sanitize_sql_like(category_title)
joins(:category).where(Category.arel_table[:title].matches(sanitized_title))
какую проблему тут решаешь?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.